﻿@model Kooboo.CMS.Content.Models.TextContent
@{
    var schema = (Kooboo.CMS.Content.Models.Schema)ViewData["Schema"];
    var folder = (Kooboo.CMS.Content.Models.TextFolder)ViewData["Folder"];

    ViewBag.Title = "Edit a content".Localize() + ": " + folder.AsActual().FriendlyText;
    Layout = "~/Views/Shared/Blank.cshtml";

    var allowedEdit = (bool)ViewData["AllowedEdit"];
    var allowedView = (bool)ViewData["AllowedView"];
    var workflowItem = Model["_WorkflowItem_"];
    var hasWorkflowItem = workflowItem != null;
    var availableEdit = hasWorkflowItem || (!hasWorkflowItem && allowedEdit);
}

@section Panel{
    @if (!string.IsNullOrEmpty(ViewBag.Menu))
    {
        @Html.Partial(ViewData["Menu"].ToString(), Model)
    }
    else
    {
        <ul class="panel">
            @if (availableEdit)
            {
                if (Model.IsLocalized == null || Model.IsLocalized.Value == false)
                {
                    @*<li class="j_DropDown">
                            <a>
                                @Html.IconImage("save")
                                @Html.IconImage("arrow small white-down")
                                @("Save".Localize())
                            </a>
                            <ul class="j_DropDownContent hide">
                                <li><a data-ajaxform="">@("Save".Localize())</a></li>
                                <li><a data-ajaxform="" href="@Url.Action("Edit", ViewContext.RequestContext.AllRouteValues().Merge("Localize", "true"))">@("Save & Localize".Localize())</a></li>
                            </ul>
                        </li>*@
                    <li><a data-ajaxform="" href="@Url.Action("Edit", ViewContext.RequestContext.AllRouteValues().Merge("Localize", "true"))">@Html.IconImage("save") @("Save".Localize())</a></li>
                }
                else
                {
                    <li>
                        <a data-ajaxform="">
                            @Html.IconImage("save") @("Save".Localize())
                        </a>
                    </li>
                }


            }

            @foreach (var group in Kooboo.CMS.Sites.Extension.UI.TopToolbar.ToolbarButtons.GetToolbarButtons(ViewContext.RequestContext))
            {
                @Html.Partial("_ToolbarGroupButtons", group)
            }

            <li>
                <a href="@ViewContext.RequestContext.GetRequestValue("return")">
                    @Html.IconImage("cancel") @("Back".Localize())
                </a>
            </li>
        </ul>
    }
}
<div class="block common-form">
    <h1 class="title">@ViewBag.Title</h1>
    @Html.Partial(ViewData["Template"].ToString(), Model)
</div>
